package com.wzh.store.controller;

import com.wzh.store.entity.District;
import com.wzh.store.service.IDistrictService;
import com.wzh.store.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author wzh
 * @create 2022/4/23 14:20
 * @Description：
 */
@RestController
@RequestMapping("districts")
public class DistrictController extends BaseController {
    @Autowired
    public IDistrictService iDistrictService;

//districts开头的请求都会被拦截到以下的方法之中
    @RequestMapping({"/",""})
    public JsonResult<List<District>> getByParent(String parent) {
        List<District> data = iDistrictService.getByParent(parent);
        return new JsonResult<>(ok, data);
    }

}
